package com.xrtn.controller;

import com.xrtn.bean.*;
import com.xrtn.page.Page;
import com.xrtn.service.IBookingService;
import com.xrtn.service.ICommonService;
import com.xrtn.service.IDoctorService;
import com.xrtn.service.ISysOrderService;
import com.xrtn.utils.CodeEnum;
import com.xrtn.utils.HttpUtils;
import com.xrtn.utils.ObjUtils;
import com.xrtn.utils.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.http.protocol.HTTP;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.ModelAndView;

import javax.jws.Oneway;
import javax.servlet.http.HttpServletRequest;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by tu_pei on 2018/3/5.
 */
@Api("预约相关接口")
@Controller
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/booking")
public class BookingController {

    @Autowired
    private ICommonService commonService;
    @Autowired
    private IBookingService bookingService;

    @Autowired
    private ISysOrderService sysOrderService;
    @InitBinder
    public void initBinder(WebDataBinder binder, WebRequest request) {
        //转换日期
        DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));// CustomDateEditor为自定义日期编辑器
    }
    /**
     * 进入快速预约页面
     * @return
     */
    @RequestMapping(value = "/gotoBooking",method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView goToBooking(ModelAndView modelAndView){
        modelAndView.setViewName("home/home-booking");
        return modelAndView;
    }
    /**
     * 进入预约管理页面
     * @return
     */
    @RequestMapping(value = "/gotoBespeak",method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView goTobespeak(ModelAndView modelAndView){
        modelAndView.setViewName("bespeak");
        return modelAndView;
    }
    /**
     * 进入预约信息详情页面
     * @return
     */
    @RequestMapping(value = "/gotoBespeakInfoDetail",method = RequestMethod.GET)
    public ModelAndView goTobespeakinfodetail(ModelAndView modelAndView){
        modelAndView.setViewName("bespeakinfodetail");
        return modelAndView;
    }
    /**
     * 快速预约查询可预约的技师接口
     * @return
     */
    @ApiOperation(value = "快速预约查询可预约的技师接口",notes="快速预约查询可预约的技师接口")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="bookingDate",dataType="string",required=false,value="预约日期",defaultValue = "2018-03-06 12:00"),
    })
    @RequestMapping(value = "/selectUserList",method = RequestMethod.GET)
    @ResponseBody
    public ResponseData selectUserList(HttpServletRequest request,String bookingDate){

        //SysUserInfo userInfo = (SysUserInfo) request.getSession().getAttribute(HttpUtils.CURRENT_USER_4_POJO);

        ResponseData data = new ResponseData();

        Map<String,Object> params = HttpUtils.getAllReqParams(request);
        //params.put("bookingDate", bookingDate);
        //params.put("subclinicId", userInfo.getSubclinicId());

        List<Map<String,Object>> userList = bookingService.selectDoctorBookingList(params);

        data.setResults(userList);

        // 返回数据
        return data;
    }

    /**
     * 添加预约
     * @return
     */
    @ApiOperation(value = "添加预约",notes="添加预约")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="userPhone",dataType="string",required=false,value="用户手机号",defaultValue = "13801020304"),
            @ApiImplicitParam(paramType="query",name="userPhones",dataType="string",required=false,value="用户手机号",defaultValue = "13805060708"),
            @ApiImplicitParam(paramType="query",name="userName",dataType="string",required=false,value="预约人姓名",defaultValue = "哈哈哈"),
            @ApiImplicitParam(paramType="query",name="bookingTime",dataType="string",required=false,value="到店时间",defaultValue = "2018-03-06 12:00:00"),
            @ApiImplicitParam(paramType="query",name="bookingDesc",dataType="string",required=false,value="预约备注",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="doctorId",dataType="int",required=false,value="预约备注",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="subclinicId",dataType="int",required=false,value="分店id",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="isAdd",dataType="int",required=false,value="isAdd = 1 开启新病程， 0 ： 继续上次治疗",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="bookingType",dataType="int",required=false,value="bookingType = 0 调理身体，1保健",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="patientId",dataType="int",required=false,value="患者id",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="patientName",dataType="int",required=false,value="患者id",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="patientGender",dataType="int",required=false,value="患者id",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="patientBirthday",dataType="int",required=false,value="患者id",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="patientBodyWeight",dataType="int",required=false,value="体重",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="patientHeight",dataType="int",required=false,value="身高",defaultValue = ""),

    })
    @RequestMapping(value = "/saveBooking",method = RequestMethod.POST)
    @ResponseBody
    public ResponseData saveBooking(TBookingInfo bookingInfo, TPatientInfo patientInfo){

        //SysUserInfo userInfo = (SysUserInfo) request.getSession().getAttribute(HttpUtils.CURRENT_USER_4_POJO);

        ResponseData data = new ResponseData();

        bookingInfo.setBookingStatus(0);
        bookingInfo.setBookingSource(1); // 后台预约

        TBookingInfo booking = commonService.saveBookingInfo(bookingInfo, patientInfo);

        if(ObjUtils.isEmpty(booking)){
            data.setCodeEnum(CodeEnum.CODE_40002);
            return data;
        }

        data.setResults(booking);
        // 返回数据
        return data;
    }
    /**
     * 添加预约
     * @return
     */
    @ApiOperation(value = "添加预约",notes="添加预约")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="userId",dataType="string",required=false,value="用户id",defaultValue = "13801020304"),
            @ApiImplicitParam(paramType="query",name="patientId",dataType="int",required=false,value="患者id",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="bookingTime",dataType="string",required=false,value="到店时间",defaultValue = "2018-03-06 12:00:00"),
            @ApiImplicitParam(paramType="query",name="bookingDesc",dataType="string",required=false,value="预约备注",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="doctorId",dataType="int",required=false,value="预约备注",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="subclinicId",dataType="int",required=false,value="分店id",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="isAdd",dataType="int",required=false,value="isAdd = 1 开启新病程， 0 ： 继续上次治疗",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="bookingType",dataType="int",required=false,value="bookingType = 0 调理身体，1保健",defaultValue = ""),
    })
    @RequestMapping(value = "/saveBookingInfo",method = RequestMethod.POST)
    @ResponseBody
    public ResponseData saveBookingInfo(HttpServletRequest request,TBookingInfo bookingInfo){

        SysUserInfo userInfo = (SysUserInfo) request.getSession().getAttribute(HttpUtils.CURRENT_USER_4_POJO);

        ResponseData data = new ResponseData();

        if(ObjUtils.isEmpty(bookingInfo.getDoctorId())){
            bookingInfo.setDoctorId(userInfo.getUserId());
        }
        if(ObjUtils.isEmpty(bookingInfo.getSubclinicId())){
            bookingInfo.setSubclinicId(userInfo.getSubclinicId());
        }
        Map<String,Object> retMap = new HashMap<>();

        if(ObjUtils.isEmpty(bookingInfo.getBookingId())){
            //快速预约 - 状态直接变为已接诊
            bookingInfo.setBookingStatus(6);
            retMap = commonService.saveBookingInfo(bookingInfo);
            if(ObjUtils.isEmpty(retMap)){
                data.setCodeEnum(CodeEnum.CODE_40002);
                return data;
            }
            data.setResults(retMap);
            return data;
        }else{
            retMap = commonService.updateBooking(bookingInfo);
            data.setResults(retMap);
            return data;
        }

    }
    /**
     * 添加预约
     * @return
     */
    @ApiOperation(value = "添加预约",notes="添加预约")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="userId",dataType="string",required=false,value="用户id",defaultValue = "13801020304"),
            @ApiImplicitParam(paramType="query",name="patientId",dataType="int",required=false,value="患者id",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="bookingTime",dataType="string",required=false,value="到店时间",defaultValue = "2018-03-06 12:00:00"),
            @ApiImplicitParam(paramType="query",name="bookingDesc",dataType="string",required=false,value="预约备注",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="doctorId",dataType="int",required=false,value="预约备注",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="subclinicId",dataType="int",required=false,value="分店id",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="isAdd",dataType="int",required=false,value="isAdd = 1 开启新病程， 0 ： 继续上次治疗",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="bookingType",dataType="int",required=false,value="bookingType = 0 调理身体，1保健",defaultValue = ""),
    })
    @RequestMapping(value = "/updateBooking",method = RequestMethod.POST)
    @ResponseBody
    public ResponseData updateBooking(HttpServletRequest request,TBookingInfo bookingInfo){
        ResponseData data = new ResponseData();
        data.setResults(commonService.updateBooking(bookingInfo));
        // 返回数据
        return data;
    }
    /**
     * 根据分店id和预约日期查询当前分店评价最高的医生
     * @return
     */
    @ApiOperation(value = "根据分店id和预约日期查询当前分店评价最高的医生",notes="根据分店id和预约日期查询当前分店评价最高的医生")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="bookingTime",dataType="string",required=false,value="到店时间",defaultValue = "2018-03-06 12:00:00"),
            @ApiImplicitParam(paramType="query",name="subclinicId",dataType="int",required=false,value="",defaultValue = ""),
    })
    @RequestMapping(value = "/selectFreeDoctor",method = RequestMethod.GET)
    @ResponseBody
    public ResponseData selectFreeDoctor(HttpServletRequest request,String bookingTime,Integer subclinicId){

        SysUserInfo userInfo = (SysUserInfo) request.getSession().getAttribute(HttpUtils.CURRENT_USER_4_POJO);

        ResponseData data = new ResponseData();

        List<Map<String, Object>> retMap = commonService.selectFreeDoctor(bookingTime, subclinicId);

        data.setResults(retMap);

        // 返回数据
        return data;
    }

    /**
     * 查询预约列表
     * @return
     */
    @ApiOperation(value = "查询预约列表",notes="查询预约列表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="patientId",dataType="int",required=false,value="患者id",defaultValue = "1"),
            @ApiImplicitParam(paramType="query",name="startDate",dataType="string",required=false,value="开始时间",defaultValue = "2018-03-01"),
            @ApiImplicitParam(paramType="query",name="endDate",dataType="string",required=false,value="结束时间",defaultValue = "2018-03-20"),
            @ApiImplicitParam(paramType="query",name="subclinicId",dataType="string",required=false,value="分店id",defaultValue = "1"),
            @ApiImplicitParam(paramType="query",name="bookingStatus",dataType="int",required=false,value="状态:0:待服务;1:已超时;2:调理中;3:待支付;4:已完成;5:取消",defaultValue = "3"),
            @ApiImplicitParam(paramType="query",name="bookingType",dataType="int",required=false,value="",defaultValue = "3"),
            @ApiImplicitParam(paramType="query",name="userPhone",dataType="int",required=false,value="手机号",defaultValue = "1"),
    })
    @RequestMapping(value = "/selectBookingList",method = RequestMethod.GET)
    @ResponseBody
    public ResponseData selectBookingList(HttpServletRequest request,Integer userId,Integer patientId,Integer bookingType,
                                          String userPhone,Integer subclinicId,Integer bookingStatus,String startDate,String endDate){

        SysUserInfo userInfo = (SysUserInfo) request.getSession().getAttribute(HttpUtils.CURRENT_USER_4_POJO);

        ResponseData data = new ResponseData();

        Map<String,Object> params = new HashMap<>();
        params.put("subclinicId",subclinicId);
        params.put("userId",userId);
        params.put("patientId",patientId);
        params.put("userPhone",userPhone);
        params.put("bookingStatus",bookingStatus);
        params.put("bookingType",bookingType);


        if(ObjUtils.isNotEmpty(startDate)){
            if(startDate.length() < 13){
                params.put("startDate",startDate+" 00:00:00");
            }else{
                params.put("startDate",startDate);
            }
        }
        if(ObjUtils.isNotEmpty(endDate)){
            if(endDate.length() < 13){
                params.put("endDate",endDate+" 23:59:59");
            }else{
                params.put("endDate",endDate);
            }
        }

        List<Map<String,Object>> bookingList = commonService.selectBookingList(params);

        data.setResults(bookingList);

        // 返回数据
        return data;
    }
    /**
     * 查询预约列表
     * @return
     */
    @ApiOperation(value = "查询预约列表-分页",notes="查询预约列表-分页")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="patientId",dataType="int",required=false,value="患者id",defaultValue = "1"),
            @ApiImplicitParam(paramType="query",name="startDate",dataType="string",required=false,value="开始时间",defaultValue = "2018-03-01"),
            @ApiImplicitParam(paramType="query",name="endDate",dataType="string",required=false,value="结束时间",defaultValue = "2018-03-20"),
            @ApiImplicitParam(paramType="query",name="subclinicId",dataType="string",required=false,value="分店id",defaultValue = "1"),
            @ApiImplicitParam(paramType="query",name="bookingStatus",dataType="int",required=false,value="状态:0:待服务;1:已超时;2:调理中;3:待支付;4:已完成;5:取消",defaultValue = "3"),
            @ApiImplicitParam(paramType="query",name="userPhone",dataType="int",required=false,value="手机号",defaultValue = "1"),
    })
    @RequestMapping(value = "/selectBookingPageList",method = RequestMethod.GET)
    @ResponseBody
    public ResponseData selectBookingPageList(Integer userId, Integer patientId,
                                          String userPhone, Integer subclinicId, Integer bookingStatus, String startDate, String endDate,
                                          Integer bookingType, Integer page, Integer limit){

        ResponseData data = new ResponseData();
        page = page == null ? 1 : page;
        limit = limit == null ? Integer.MAX_VALUE : limit;
        Page pages = Page.newBuilder(page, limit);
        Map<String,Object> params = new HashMap<>();
        params.put("subclinicId",subclinicId);
        params.put("userId",userId);
        params.put("patientId",patientId);
        params.put("userPhone",userPhone);
//        params.put("bookingStatus",bookingStatus);
        if (bookingStatus == null) {
            params.put("bookingStatus", null);
            params.put("treatmentState", null);
        } else {
            switch (bookingStatus) {
                case 4: {
                    params.put("bookingStatus", 4);
                    params.put("treatmentState", 1);
                    break;
                }
                case 7: {
                    params.put("bookingStatus", 4);
                    params.put("treatmentState", 0);
                    break;
                }case 8: {
                    params.put("bookingStatus", 4);
                    params.put("treatmentState", 2);
                    break;
                }
                default: {
                    params.put("bookingStatus", bookingStatus);
                    params.put("treatmentState", 0);
                    break;
                }
            }
        }

        params.put("bookingType", bookingType);
        if(ObjUtils.isNotEmpty(startDate)){
            if(startDate.length() < 13){
                params.put("startDate",startDate+" 00:00:00");
            }else{
                params.put("startDate",startDate);
            }
        }
        if(ObjUtils.isNotEmpty(endDate)){
            if(endDate.length() < 13){
                params.put("endDate",endDate+" 23:59:59");
            }else{
                params.put("endDate",endDate);
            }
        }
        Page bookingPage = commonService.selectBookingPageList(pages,params);
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("rows", bookingPage.getItems());
        map.put("records", bookingPage.getTotalRecord());
        map.put("total", bookingPage.getTotalPage());
        map.put("page", bookingPage.getPageNo());
        data.setResults(map);

        // 返回数据
        return data;
    }
    /**
     * 按周查询预约看板
     * @return
     */
    @ApiOperation(value = "按周查询预约看板",notes="按周查询预约看板")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="startDate",dataType="string",required=false,value="开始时间",defaultValue = "2018-04-09"),
            @ApiImplicitParam(paramType="query",name="endDate",dataType="string",required=false,value="结束时间",defaultValue = "2018-04-15"),
            @ApiImplicitParam(paramType="query",name="subclinicId",dataType="string",required=false,value="分店id",defaultValue = "1"),
            @ApiImplicitParam(paramType="query",name="bookingStatus",dataType="int",required=false,value="是否初诊:0:是;1:否",defaultValue = "0"),
            @ApiImplicitParam(paramType="query",name="userPhone",dataType="int",required=false,value="用户姓名||手机号||大夫姓名",defaultValue = "1"),
    })
    @RequestMapping(value = "/selectBookingWeekList",method = RequestMethod.GET)
    @ResponseBody
    public ResponseData selectBookingWeekList(HttpServletRequest request,String userPhone,Integer subclinicId,
                                              Integer bookingStatus,String startDate,String endDate,Integer bookingType, Integer fromInput){

        SysUserInfo userInfo = (SysUserInfo) request.getSession().getAttribute(HttpUtils.CURRENT_USER_4_POJO);

        ResponseData data = new ResponseData();

        Map<String,Object> params = new HashMap<>();
        params.put("subclinicId",subclinicId);
        params.put("userPhone",userPhone);
        params.put("isFirst",bookingStatus);
        params.put("bookingType",bookingType);
        if(ObjUtils.isNotEmpty(startDate)){
            params.put("startDate",startDate+" 00:00:00");
        }
        if(ObjUtils.isNotEmpty(endDate)){
            params.put("endDate",endDate+" 23:59:59");
        }
        if (fromInput == 1) {
            data.setResults(commonService.selectBookingStatInfo(params));
        } else {
            data.setResults(commonService.selectBookingWeekList(params));
        }

        // 返回数据
        return data;
    }
    /**
     * 查询预约列表
     * @return
     */
    @ApiOperation(value = "查询预约列表",notes="查询预约列表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="subclinicId",dataType="string",required=false,value="分店id",defaultValue = "1"),
    })
    /**
     * 预约看板
     */
    @RequestMapping(value = "/selectBookingBoardList",method = RequestMethod.GET)
    @ResponseBody
    public ResponseData selectBookingBoardList(HttpServletRequest request,Integer subclinicId){
        SysUserInfo userInfo = (SysUserInfo) request.getSession().getAttribute(HttpUtils.CURRENT_USER_4_POJO);

        ResponseData data = new ResponseData();

        Map<String,Object> params = HttpUtils.getAllReqParams(request);

        data.setResults(commonService.selectBookingBoardList(params));

        // 返回数据
        return data;
    }

    /**
     * 按医师分组查询当天预约列表
     * @return
     */
    @ApiOperation(value = "按医师分组查询当天预约列表",notes="按医师分组查询当天预约列表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="subclinicId",dataType="int",required=false,value="分店id",defaultValue = "1"),
            @ApiImplicitParam(paramType="query",name="bookingDate",dataType="string",required=false,value="时间：",defaultValue = "2018-03-01"),
            @ApiImplicitParam(paramType="query",name="bookingType",dataType="int",required=false,value="",defaultValue = ""),
            @ApiImplicitParam(paramType="query",name="isFirst",dataType="int",required=false,value="预约类型：全部：不传；0：初诊；1：复诊",defaultValue = "2018-03-01"),
    })
    @RequestMapping(value = "/selectDoctorGroupBookingList",method = RequestMethod.GET)
    @ResponseBody
    public ResponseData selectDoctorGroupBookingList(HttpServletRequest request,Integer subclinicId,String bookingDate,Integer isFirst){
        //SysUserInfo userInfo = (SysUserInfo) request.getSession().getAttribute(HttpUtils.CURRENT_USER_4_POJO);

        ResponseData data = new ResponseData();

        Map<String,Object> params = HttpUtils.getAllReqParams(request);

        data.setResults(commonService.selectBookingBoardList(params));

        // 返回数据
        return data;
    }

    /**
     * 取消预约
     * @return
     */
    @ApiOperation(value = "取消预约",notes="取消预约")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="bookingId",dataType="int",required=false,value="预约单号",defaultValue = "1"),
    })
    @RequestMapping(value = "/cancelBooking",method = RequestMethod.POST)
    @ResponseBody
    public ResponseData cancelBooking(Integer bookingId){

        ResponseData data = new ResponseData();

        // TODO 取消预约要验证预约和订单的状态是否是已完成

        TBookingInfo bookingInfo = new TBookingInfo();
        bookingInfo.setBookingId(bookingId);
        bookingInfo.setBookingStatus(5);
        bookingInfo.setCancelTime(new Date());
        bookingInfo.setCancelType(2);
        Integer count = bookingService.updateBooking(bookingInfo);

        Map<String,Object> params = new HashMap<>();
        params.put("bookingId", bookingInfo.getBookingId());
        TOrderInfo bookingOrder = sysOrderService.selectOrderInfoByBookingId(params);
        if(ObjUtils.isNotEmpty(bookingOrder)){
            TOrderInfo orderInfo = new TOrderInfo();
            orderInfo.setOrderId(bookingOrder.getOrderId());
            orderInfo.setOrderState(4);
            count += sysOrderService.updateOrderInfo(orderInfo);
        }
        if(count < 0){
            data.setCodeEnum(CodeEnum.CODE_6);
        }
        // 返回数据
        return data;
    }
    /**
     * 查询预约详情
     * @return
     */
    @ApiOperation(value = "查询预约详情",notes="查询预约详情")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="bookingId",dataType="int",required=false,value="预约单号",defaultValue = "1"),
    })
    @RequestMapping(value = "/selectBookingInfo",method = RequestMethod.GET)
    @ResponseBody
    public ResponseData selectBookingInfo(Integer bookingId){

        ResponseData data = new ResponseData();

        Map<String,Object> params = new HashMap<>();
        params.put("bookingId", bookingId);

        Map<String,Object> bookingMap = bookingService.selectBookingInfo(params);

        data.setResults(bookingMap);

        // 返回数据
        return data;
    }
    /**
     * 修改预约详情
     * @return
     */
    @ApiOperation(value = "修改预约详情",notes="修改预约详情")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query",name="bookingId",dataType="int",required=false,value="预约单号",defaultValue = "1"),
    })
    @RequestMapping(value = "/updateBookingInfo",method = RequestMethod.POST)
    @ResponseBody
    public ResponseData updateBookingInfo(TBookingInfo bookingInfo){

        ResponseData data = new ResponseData();

        Integer count = bookingService.updateBookingInfo(bookingInfo);

        if( count < 0 ){
            data.setCodeEnum(CodeEnum.CODE_6);
            return data;
        }

        // 返回数据
        return data;
    }
}
